def data_count():
    data = [12, 45, 67, 23, 89, 34, 56, 78, 90, 11, 22, 33, 44, 55, 66, 77, 88, 99, 10, 2]
    sum = 0  # 存放求和结果
    n_max = None
    n_min = None  # 存放最大最小值
    index = 0  # 遍历列表时所用索引
    while index < len(data):
        if (n_max is None) and (n_min is None):
            n_max = n_min = data[index]
        elif data[index] > n_max:
            n_max = data[index]
        elif data[index] < n_min:
            n_min = data[index]
        sum += data[index]
        avg = sum / len(data)
        index += 1
    print(f'和为{sum}\n'
          f'最大值为{n_max}\n'
          f'最小值为{n_min}\n'
          f'平均数为{avg}')

if __name__ == '__main__':
    data_count()